<%--
  Created by IntelliJ IDEA.
  User: 小文
  Date: 2021/6/23
  Time: 15:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加车辆租赁信息</title>
</head>
<body>
    <form action="${pageContext.request.contextPath}/rent/add" method="post">
        <table border="1">
            <tr>
                <td colspan="2" >添加车位租赁信息</td>
            </tr>
            <tr>
                <td>租赁人姓名(*)</td>
                <td><input type="text" name="userName" id="userName"></td>
            </tr>
            <tr>
                <td>车牌号(*)</td>
                <td>
                    <input type="text" name="carNum" id="carNum"><br>
                    <span style="color: red" id="sp"></span>
                </td>
            </tr>
            <tr>
                <td>到期日期(*)</td>
                <td><input type="text" name="maturityDate" id="maturityDate"></td>
            </tr>
            <tr>
                <td colspan="2" align="center"><input type="submit" value="提交"></td>
            </tr>
        </table>
    </form>
<script src="../../js/jquery-1.8.3.js"></script>
<script>
    $(document).ready(function () {
        $("#carNum").blur(function () {
            var carNum = $(this).val();
            var str = "";
            $.post("CountServlet","carNum="+carNum,function (data) {
                if (data > 0){
                    str = "该车牌号已存在";
                }else {
                    str = "";
                }
                $("#sp").text(str);
            })
        })
    })
</script>
</body>
</html>
